/*
 * Copyright (c) [2019] [lookang]
 *    [Software Name] is licensed under the Mulan PSL v1.
 *    You can use this software according to the terms and conditions of the Mulan PSL v1.
 *    You may obtain a copy of Mulan PSL v1 at:
 *       http://license.coscl.org.cn/MulanPSL
 *    THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
 *    IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
 *    PURPOSE.
 *    See the Mulan PSL v1 for more details.
 */

package com.lookang.demo.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author liulekang
 * @date 2019/11/22
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResultVO {

    private static final String successCode = "000000";
    private static final String FAILED_CODE = "000001";
    private static final String successMsg = "操作成功";
    private static final ResultVO RESULT_SUCCESS = new ResultVO(successCode, successMsg, null);
    private static ResultVO RESULT_FAILED = new ResultVO();

    private String code;
    private String msg;
    private Object obj;

    public static ResultVO success() {
        return RESULT_SUCCESS;
    }

    public static ResultVO failed(String msg) {
        RESULT_FAILED.setCode(FAILED_CODE);
        RESULT_FAILED.setMsg(msg);
        return RESULT_FAILED;
    }

    public static ResultVO failed(String code,String msg) {
         RESULT_FAILED.setCode(code);
         RESULT_FAILED.setMsg(msg);
         return RESULT_FAILED;
    }

}
